package com.angel.mocks.factories;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.RandomStringUtils;

import com.angel.mocks.dao.generic.Course;
import com.angel.mocks.dao.generic.Exam;
import com.angel.mocks.dao.generic.Person;
import com.angel.mocks.dao.generic.Teacher;

public class DomainMockFactory {

	private DomainMockFactory(){
		super();
	}

	public static List<Course> createCourse(int quantity){
		List<Course> courses = new ArrayList<Course>();
		for(int i = 0; i< quantity; i++){
			courses.add(createCourse());
		}
		return courses;
	}

	public static List<Exam> createExam(int quantity){
		List<Exam> exams = new ArrayList<Exam>();
		for(int i = 0; i< quantity; i++){
			exams.add(createExam());
		}
		return exams;
	}

	public static List<Person> createPerson(int quantity){
		List<Person> persons = new ArrayList<Person>();
		for(int i = 0; i< quantity; i++){
			persons.add(createPerson());
		}
		return persons;
	}

	public static Course createCourse(){
		Course course = new Course(createPerson(4));
		course.setTeacher(createTeacher());
		return course;
	}

	public static Exam createExam(){
		Exam exam = new Exam(createTeacher(),createPerson());
		return exam;
	}

	public static Person createPerson(){
		Person person = new Person();
		person.setAge(Integer.valueOf(RandomStringUtils.randomNumeric(2)));
		person.setName(RandomStringUtils.randomNumeric(10));
		return person;
	}

	public static Teacher createTeacher(){
		Teacher teacher = new Teacher();
		teacher.setAge(Integer.valueOf(RandomStringUtils.randomNumeric(2)));
		teacher.setName(RandomStringUtils.randomNumeric(10));
		return teacher;
	}
}
